<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>
<head>
	<meta name="decorator" content="moduleEdit" />
	<script type="text/javascript" src="${staticPath}/js/brand.js"></script>
	<script type="text/javascript">
		$(document).ready(function() { 
			//$("#brandCname").focus();
			$("#brandCustForm").validate({
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
				
			});
			$("#save").click( function () {
				//品牌风格checked
				setCheckedIds("brand_style","#brandCust_brandStyle");
				//收入层checked
				setCheckedIds("income_level","#brandCust_incomeLevel");
				//年龄层checked
				setCheckedIds("age_level","#brandCust_ageLevel");
				Oosp_Loading('正在提交，请稍等...');
				$("#brandCustForm").submit(); 
			});
		});
		
		function setCheckedIds(vname,vid)
		{
			var str = "";
			$("input[name="+vname+"]:checked").each(function(i){
				str+=this.value+"##";
			});
			str = str.substring(0,str.length-2);
			$(vid).val(str);
		}
	</script>
<style type="text/css">
h4{ border-bottom:1px dotted #ccc; padding-bottom:10px; margin:30px 0 15px; color:#b12028; font-size: 12px;}
</style>
</head>
<body>

<div class="Report_f">
           <div class="Report_f_1">
                <div class="Report_f_title_1">品牌准入</div>
                <ul class="nav nav-tabs Report_f_title_2">
                    <li><a href="#label_1" data-toggle="tab">市场定位</a></li>
                  </ul>
			<!-- Tab panes -->
			<div class="tab-content Report_f_title_3">
                  <div class="tab-pane active" id="label_1">
                         <div class="Report_f_title_4">
                         <form:form id="brandCustForm" name="brandCustForm"  modelAttribute="brandCust" action="${contextPath}/biz/brand/brandcust/save" method="post" class="form-inline" role="form">
     					<form:hidden path="id"/>
						<form:hidden path="brandCateId"/>
						<tags:message content="${message}"/>
						<form:hidden path="brandStyle" id="brandCust_brandStyle"/>
						<form:hidden path="incomeLevel" id="brandCust_incomeLevel"/>
						<form:hidden path="ageLevel" id="brandCust_ageLevel"/>
						<div class="f_3">
		                      <div class="form-group col-xs-12">
								<label for="brand_style" class="col-lb-1 control-label f_10">品牌风格:</label>
								<div class="col-sm-10 col-lb-2 f_6">
									<c:forEach items="${styleList}" var="item" varStatus="status">
											<input type="checkbox" name= "brand_style" 
													<c:forEach items="${brandCust.styleList}" var="itemEd" varStatus="status2">
														<c:if test="${item.styleNo == itemEd}">
															checked="checked"
														</c:if>
													</c:forEach>
											 id="${item.styleNo}" value = "${item.styleNo}"/> ${item.styleName}
									</c:forEach>
								</div>
							 </div>
						</div>
						<div class="f_2">
							<div class="form-group col-sm-6">
								<label for="publicity" class="col-sm-3 control-label f_4">品牌知名度:</label>
								<div class="col-sm-9 f_6">
									<ossp:select dictType="brandPublicity" defaultSelected="${brandCust.publicity }" name="publicity"id="brandCust_publicity" class_="form-control"></ossp:select>
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="cusPrice" class="col-sm-3 control-label f_4">客单价:</label>
								<div class="col-sm-9 f_6">
									<ossp:select dictType="brandCusPrice" defaultSelected="${brandCust.cusPrice }" name="cusPrice"id="brandCust_cusPrice" class_="form-control"></ossp:select>
								</div>
							</div>
					   </div>
					   <div class="f_3">
		                      <div class="form-group col-xs-12">
								<label for="incomeLevelList" class="col-lb-1 control-label f_10">收入层:</label>
								<div class="col-sm-10 col-lb-2 f_6">
									<c:forEach items="${dictIncomeLevelList}" var="item" varStatus="status">
											<input type="checkbox" name= "income_level" 
													<c:forEach items="${brandCust.incomeLevelList}" var="itemEd" varStatus="status2">
														<c:if test="${item.key == itemEd}">
															checked="checked"
														</c:if>
													</c:forEach>
											 id="${item.key}" value = "${item.key}"/> ${item.value}
									</c:forEach>
								</div>
							 </div>
						</div>
						<div class="f_3">
		                      <div class="form-group col-xs-12">
								<label for="ageLevelList" class="col-lb-1 control-label f_10">年龄层:</label>
								<div class="col-sm-10 col-lb-2 f_6">
									<c:forEach items="${dictAgeLevelList}" var="item" varStatus="status">
											<input type="checkbox" name= "age_level" 
													<c:forEach items="${brandCust.ageLevelList}" var="itemEd" varStatus="status2">
														<c:if test="${item.key == itemEd}">
															checked="checked"
														</c:if>
													</c:forEach>
											 id="${item.key}" value = "${item.key}"/> ${item.value}
									</c:forEach>
								</div>
							 </div>
						</div>
						<div class="f_2">
							<div class="form-group col-sm-6">
								<label for="monthConsumeOrder" class="col-sm-3 control-label f_4">月消费频次:</label>
								<div class="col-sm-9 f_6">
									<ossp:select dictType="brandMonthCsmOrder" defaultSelected="${brandCust.monthConsumeOrder }" name="monthConsumeOrder"id="brandCust_monthConsumeOrder" class_="form-control"></ossp:select>
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="priceLevel" class="col-sm-3 control-label f_4">商品价格带:</label>
								<div class="col-sm-9 f_6">
									<form:input id="brandCust_priceLevel" path="priceLevel" maxlength="20" class="form-control required"/>
								</div>
							</div>
					   </div>
					   <div class="f_12">
					     <button type="button" class="btn btn-danger btn_5 btn_right" onclick="javascript:back('${contextPath}/biz/brand/brandcate/apply');">返&nbsp;回</button>
					     <button type="button" id="save" class="btn btn-success btn_5 btn_right" <c:if test="${brandCust.brandCateId == null}">disabled="disabled"</c:if>>保&nbsp;存</button>
					   </div>
     					 </form:form>
                   </div>
              </div>
		  </div>
	</div>	
</div>
</body>
</html>